<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<%@include file="/comm/pub.inc"%>
		<script type="text/javascript" src="<%=contextPath %>/web/system/pub.js" ></script>
		<script type="text/javascript" >
			function myValidation(){
				var data = new mini.Form('editWin').getData();
				if (data.id == data.parentId){
					mini.alert('父级菜单不能为自己！');
					return false;
				}
				return true;
			}
			function iconRender(e){
				var val = e.value;
				return "<span class='"+val+"' style='display:block;height:20px;' ></span>";
			}
		</script>
	</head>
	<body>
		<div id="queryForm" >
			<div style="width:800px;" >
				<table class="input-table" >
					<tr>
						<td >菜单名称：</td>
						<td><input style="width:200px;" type="text" class="mini-textbox" name="name"/>
						</td>
						<td>上级菜单：</td>
						<td width=250 >
							<input name="parentId" showNullItem=true class="mini-combobox" style="width:200px;" textField="name" valueField="id" url="<%=contextPath %>/action/system/menu/queryParent" />
						</td>
						<td><a class="mini-button" iconCls="icon-search" onclick="search()" >查询</a></td>
						<td></td>
					</tr>
				</table>
			</div>
		</div>
		<div style="width:100%;">
		        <div class="mini-toolbar" style="border-bottom:0;padding:0px;">
		            <table style="width:100%;">
		                <tr>
		                    <td style="width:100%;">
		                        <a class="mini-button" iconCls="icon-add" onclick="toAddWin" plain="true">新增</a>
		                        <a class="mini-button" iconCls="icon-edit" onclick="toEditWin" plain="true">编辑</a>
		                        <a class="mini-button" iconCls="icon-remove"
		                         onclick="deleteData('<%=contextPath %>/action/system/menu/delete')" plain="true">删除</a>
		                    </td>
		                    
		                </tr>
		            </table>           
		        </div>
		    </div>
			<div id="dataGrid" url="<%=contextPath %>/action/system/menu/page" class="mini-datagrid" style="width:100%;height:400px;"
				multiSelect="false"  sizeList="[20,40,80]" pageSize="20" >
			<div property="columns">
					<div type="checkcolumn" ></div>
						<div type="indexcolumn" >序号</div> 
						<div field="id" width="120" visible=false >id</div>   
						<div field="id" name="id" width="120">编码</div>           
						<div field="name" name="name" width="120">名称
						</div>
						<div field="url" name="url" width="120">链接
						</div>
						<div type="comboboxcolumn" autoShowPopup="true" field="parentId" name="parentId" width="120">父级菜单
						<input property="editor" class="mini-combobox" style="width:100%;" textField="name" valueField="id" url="<%=contextPath %>/action/system/menu/queryParent" />
						</div>
						<div field="iconStyle" name="iconStyle" width="120" renderer="iconRender">图标
						</div>
						<div field="seq" name="seq" width="120">排序
						</div>
						<div field="createDate" name="createDate" width="120" dateFormat="yyyy-MM-dd HH:mm:ss" >创建日期
						</div>
						<div field="updateDate" name="updateDate" width="120" dateFormat="yyyy-MM-dd HH:mm:ss" >修改日期
						</div>
					</div>
			</div>
		<!-- 添加功能窗口 -->
		<div id="addWin" class="mini-window" title="添加菜单" iconCls="icon-add" style="width:600px;height:300px;overflow:hidden;" 
   			showMaxButton="false" showToolbar="false" showFooter="true" showModal="true" 
   			 allowResize="false" allowDrag="true"  >
   			 <table class="input-table" id="addForm" action="<%=contextPath %>/action/system/menu/add" >
   			 	<tr>
   			 		<td width=80 ><label>编码：</label></td>
   			 		<td><input name="id" class="mini-textbox" maxLength="32" style="width:100%" emptyText="必填" requiredErrorText="不能为空" required /></td>
   			 		<td><label>菜单名称：</label></td>
   			 		<td><input name="name"  class="mini-textbox" maxLength="25" style="width:100%" emptyText="必填" requiredErrorText="不能为空" required /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>上级菜单：</label></td>
   			 		<td><input name="parentId"  class="mini-combobox" style="width:100%;" textField="name" valueField="id" url="<%=contextPath %>/action/system/menu/queryParent" requiredErrorText="请选择" required /></td>
   			 		<td><label>图标：</label></td>
   			 		<td><input name="iconStyle"  class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>链接：</label></td>
   			 		<td colspan=3 ><input name="url" maxLength="200" class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>顺序：</label></td>
   			 		<td><input name="seq" maxLength="10" class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 </table>
   			 <div property="footer" align="center" >
		        <a class="mini-button" iconCls="icon-save" onclick="saveAddData" >保存</a>
		        <a class="mini-button" iconCls="icon-close" onclick="closeAddWin" >关闭</a>
		    </div>
		</div>
		<!-- 修改功能窗口 -->
		<div id="editWin" class="mini-window" title="修改菜单" iconCls="icon-add" style="width:600px;height:300px;overflow:hidden;" 
   			showMaxButton="false" showToolbar="false" showFooter="true" showModal="true" 
   			 allowResize="false" allowDrag="true"  >
   			 <table class="input-table" id="editForm" action="<%=contextPath %>/action/system/menu/modify" >
   			 	<tr>
   			 		<td width=80 ><label>编码：</label></td>
   			 		<td><input name="id" enabled=false class="mini-textbox" maxLength="32" style="width:100%" emptyText="必填" requiredErrorText="不能为空" required /></td>
   			 		<td><label>菜单名称：</label></td>
   			 		<td><input name="name"  class="mini-textbox" maxLength="25" style="width:100%" emptyText="必填" requiredErrorText="不能为空" required /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>上级菜单：</label></td>
   			 		<td><input name="parentId" class="mini-combobox" style="width:100%;" textField="name" valueField="id" url="<%=contextPath %>/action/system/menu/queryParent" requiredErrorText="请选择" required /></td>
   			 		<td><label>图标：</label></td>
   			 		<td><input name="iconStyle"  class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>链接：</label></td>
   			 		<td colspan=3 ><input name="url" maxLength="200" class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 	<tr>
   			 		<td><label>顺序：</label></td>
   			 		<td><input name="seq" maxLength="10" class="mini-textbox" style="width:100%" /></td>
   			 	</tr>
   			 </table>
   			 <div property="footer" align="center" >
		        <a class="mini-button" iconCls="icon-save" onclick="saveEditData" >保存</a>
		        <a class="mini-button" iconCls="icon-close" onclick="closeEditWin" >关闭</a>
		    </div>
		</div>
	</body>
</html>
